<template>
  <div>
    <div class="banner" @click="hdBannerClick">
      <img class="banner-img" :src="bannerImg" />
      <div class="banner-info">
        <div class="banner-title">{{ sightName }}</div>
        <div class="banner-number">
          <span class="iconfont banner-icon">&#xe692;</span>
          &nbsp;{{ gallaryImgs.length }}
        </div>
      </div>
    </div>
    <Fade>
      <Gallary :imgs="gallaryImgs" v-show="showGallary" @closeGallary="closeGallary" />
    </Fade>
  </div>
</template>

<script>
// import Gallary from '@components/Gallary'
import Fade from '@components/Fade'

export default {
  name: 'Banner',

  components: {
    Gallary: () => import('@components/Gallary'),
    Fade,
  },

  props: ['sightName', 'bannerImg', 'gallaryImgs'],

  data() {
    return {
      showGallary: false,
      imgs: [
        '//img1.qunarzz.com/sight/p0/1507/a3/a37ced8252b273c9.img.jpg_600x330_d7e04f5c.jpg',
        '//img1.qunarzz.com/sight/p0/1507/c5/c5bf379142fcd62c.img.jpg_r_800x800_1767618a.jpg',
        'http://img1.qunarzz.com/sight/p0/1507/11/111287098a524223.img.jpg_r_800x800_c9e05004.jpg',
      ],
    }
  },

  methods: {
    hdBannerClick() {
      this.showGallary = true
    },
    closeGallary() {
      this.showGallary = false
    },
  },
}
</script>

<style lang="scss" scoped>
.banner {
  position: relative;
  overflow: hidden;
  height: 0;
  padding-bottom: 55%;
}
.banner .banner-img {
  width: 100%;
}
.banner .banner-info {
  display: flex;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  line-height: 0.6rem;
  color: #fff;
  background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.6));
}
.banner .banner-title {
  flex: 1;
  text-align: start;
  font-size: 0.32rem;
  padding: 0 0.2rem;
}
.banner .banner-number {
  margin-top: 0.14rem;
  padding: 0 0.4rem;
  height: 0.32rem;
  line-height: 0.32rem;
  border-radius: 0.2rem;
  background: rgba(0, 0, 0, 0.8);
  font-size: 0.24rem;
}
.banner .banner-icon {
  font-size: 0.24rem;
}
</style>
